import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mirac
 * Date: 2025-07-29
 * Time: 19:14
 */
public class Solution {
    public void rotate(int[] nums, int k) {
        k = k % nums.length;
        if(k == 0)return;

        int[] arr = new int[nums.length];
        for (int i = 0;i < k;i++) {
            arr[i] = nums[nums.length - k + i];
        }
        for (int i = 0; i < nums.length - k; i++) {
            arr[k + i] = nums[i];
        }
        for (int i = 0; i < nums.length; i++) {
            nums[i] = arr[i];
        }
    }
}
